home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
shape.lha
/
shape
/
shape.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
796b
|
52 lines
include "shape.h"
include "screen.h"
hape_lst shape_list;
ectangle::rectangle(point a, point b)
if (a.x <= b.x) {
if (a.y <= b.y) {
sw = a;
ne = b;
} else {
sw = point(a.x, b.y);
ne = point(b.x, a.y);
}
} else {
if (a.y <= b.y) {
sw = point(b.x, a.y);
ne = point(a.x, b.y);
} else {
sw = b;
ne = a;
}
}
oid rectangle::draw()
point nw(sw.x, ne.y);
point se(ne.x, sw.y);
put_line(nw,ne);
put_line(ne,se);
put_line(se,sw);
put_line(sw,nw);
oid shape_refresh()
screen_clear();
sl_iterator next(shape_list);
shape* p;
while (p = next() ) p->draw();
screen_refresh();
oid stack(shape* q, shape* p) // put p on top of q
point n = p->north();
point s = q->south();
q->move(n.x-s.x, n.y-s.y+1);